package com.tong.cloud.feign.expander;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import feign.Param;

public class ToJsonExpander implements Param.Expander {
    private static ObjectMapper objectMapper = new ObjectMapper();

    public String expand(Object value) {
        try {
            return objectMapper.writeValueAsString(value);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
    }
}
